﻿import java.util.Scanner;

public class Demo3 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String name;
		int age;
		String gender;
		System.out.println("输入姓名：");
		name = sc.next();

		System.out.println("输入年龄：");
		while (!sc.hasNextInt()) {
			String str = sc.next();
			System.out.println("输入有误，请重新输入年龄：");
		}
		age = sc.nextInt();
		if (age < 0) {
			System.out.println("年龄不能为负数！");
			return;
		}

		System.out.println("输入性别：");
		gender = sc.next();
		if (!gender.equals("男") && !gender.equals("女")) {
			System.out.println("性别输出有误");
			return;
		}

		System.out.println("姓名：" + name);
		System.out.println("年龄：" + age);
		System.out.println("性别：" + gender);
	}
}
